﻿<!-- #include file="include/md5.asp" -->
<!--#include file="include/config.asp"-->
<!--#include file="include/conn_f.asp"-->
<!--#include file="ipcountry/ipcountry.asp" -->
<!--#include file="top.asp"-->
<!--#include file="left.asp"-->
<%
If ISVIP<>1 Then
    Response.Write "此功能仅供VIP用户使用!"
    Response.End
End If

bank_name=request("bank_name")
name=request("name")
account_name=request("account_name")
amount=ccur(request("amount"))
province=request("province")
recv_phone=request("recv_phone")
recv_name=request("recv_name")
recv_qq=request("recv_qq")
usage=request("usage")
sender_name=request("sender_name")
sender_phone=request("sender_phone")
sender_qq=request("sender_qq")
memo_text=request("memo_text")
IP=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If IP="" Then
    IP=Request.ServerVariables("remote_addr")
End If
ip_address=split(IP,",",-1,1)
If UBound(ip_address)>-1 and len(ip_address(0))>7 Then
    ipcountry=IP2Country(ip_address(0))
Else
    ipcountry="CN"
End If
cust_id=Session("cust_id")
If amount<50 or amount>5000 Then
    Response.Write "<font color='red'>汇款金额必须大于50元,小于5000元!</font><br />"
    Response.End
Else
    total_amount=int(amount*105)/100 
End If

src = "account_name=" + account_name + "&amount="&total_amount&"&key=" + key
mac=md5(src)


sql="insert into orders(cust_id,goods_type,total_amount,order_time,IP,IPCOUNTRY) values("&cust_id&",2,"&total_amount&",now(),'"&IP&"','"&ipcountry&"')"
conn.execute sql
sql="select LAST_INSERT_ID() from orders"
Set rs=conn.execute(sql)
orders_id=rs(0)
rs.close

sql="insert into orders_detail(orders_id,goods_type,amount) values("&orders_id&",2,"&total_amount&")"
conn.execute sql
sql="select LAST_INSERT_ID() from orders_detail"
rs.open sql,conn
order_detail_id=rs(0)
rs.close

sql="insert into huikuan(orders_id,order_detail_id,bank_name,name,account_name,amount,province,recv_phone,recv_name,"
sql=sql&"recv_qq,sender_name,sender_phone,sender_qq,usages,memo_text,md5) "
sql=sql&"values("&orders_id&","&order_detail_id&",'"&bank_name&"','"&name&"','"&account_name&"',"
sql=sql&amount&",'"&province&"','"&recv_phone&"','"&recv_name&"','"
sql=sql&recv_qq&"','"&sender_name&"','"&sender_phone&"','"&sender_qq&"','"&usage&"','"&memo_text&"','"&mac&"')"

conn.execute(sql)
sql="select * from huikuan order by huikuan_id desc limit 0,1"
Set rs=conn.execute(sql)
If Not rs.eof Then
%>
<br />
<table bgcolor="#cccccc" align="center" width="550" border="0" cellpadding="3" cellspacing="1">
    <tr bgcolor="#FFFFFF">
        <td width="100">
            收款方信息
        </td>
        <td width="450">
            <table width="100%">
                <tr>
                    <td width="30%">
                        开户银行名称
                    </td>
                    <td width="70%">
                        <%=rs("bank_name")%>
                    </td>
                </tr>
                <tr>
                    <td>
                        姓名(银行帐号上的姓名)
                    </td>
                    <td>
                        <%=rs("name")%>
                    </td>
                </tr>
                <tr>
                    <td>
                        银行帐号(或卡号)
                    </td>
                    <td>
                        <%=rs("account_name")%>
                    </td>
                </tr>
                <tr>
                    <td>
                        金额(人民币)
                    </td>
                    <td>
                        <%=rs("amount")%>元
                    </td>
                </tr>
                <tr>
                    <td>
                        开户省市
                    </td>
                    <td>
                        <%=rs("province")%>
                    </td>
                </tr>
                <tr>
                    <td>
                        联系电话
                    </td>
                    <td>
                        <%=rs("recv_phone")%>
                    </td>
                </tr>
                <tr>
                    <td>
                        联系人
                    </td>
                    <td>
                        <%=rs("recv_name")%>
                    </td>
                </tr>
                <tr>
                    <td>
                        联系人QQ或E-mail
                    </td>
                    <td>
                        <%=rs("recv_qq")%>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr bgcolor="#FFFFFF">
        <td>
            汇款方信息
        </td>
        <td>
            <table width="100%">
                <tr>
                    <td width="30%">
                        联系人
                    </td>
                    <td width="70%">
                        <%=rs("sender_name")%>
                    </td>
                </tr>
                <tr>
                    <td>
                        联系电话
                    </td>
                    <td>
                        <%=rs("sender_phone")%>
                    </td>
                </tr>
                <tr>
                    <td>
                        联系人QQ或E-mail
                    </td>
                    <td>
                        <%=rs("sender_qq")%>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr bgcolor="#FFFFFF">
        <td>
            商品/服务网址(URL)
        </td>
        <td>
            <%=rs("usages")%>
        </td>
        <tr bgcolor="#FFFFFF">
            <td>
                备注
            </td>
            <td>
                <%=rs("memo_text")%>
            </td>
            <tr bgcolor="#FFFFFF">
                <td colspan="2" align="center">
                    <input type="button" value="需要修改" onclick="javascript:history.go(-1)">
    &nbsp;&nbsp;
</table>
<center>
    <font color="red">请再次核对填写的资料!汇款手续费为5%,外币价格按下面计算好的金额<br />
    </font>如果没有疑问,请按下面的付款按钮,付款完成后我们将执行您的汇款/代购操作!<br />
    <font color='green'>代购/代汇款定单的处理时间是每天的9:00-17:00(北京时间)</font><br />
    <form action="ckout.asp" method="post">
    <input name="orders_id" value="<%=orders_id%>" type="hidden">
    <input type="submit" value="确认定单,去支付(Pay)">
    </form>
</center>
<%
End If

%>
<!--#include file="bottom.asp"-->
